package com.four.order.web.controller;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.four.order.config.PaymentConfig;
import com.four.order.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: hxw
 * @Date: 2022/1/17 21:55
 */
@RestController
@RequestMapping("order")
public class PayController {
    @Autowired
    private PayService payService;

    /**
     * 支付
     * @param orId
     * @param token
     * @return
     */
    @GetMapping("toPay/{orId}/{token}")
    public String toPay(
            @PathVariable("orId") Integer orId,
            @PathVariable("token") String token) {

        return payService.toPay(orId,token);
    }
}
